package com.huan.lossless.controller;

import com.alibaba.nacos.api.exception.NacosException;
import com.huan.lossless.LosslessOfflineApi;
import com.huan.lossless.feign.FeignProvider;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 消费者控制器
 *
 * @author huan.fu
 * @date 2023/3/6 - 22:03
 */
@RestController
public class ConsumerController {

    @Resource
    private FeignProvider feignProvider;
    @Resource
    private LosslessOfflineApi losslessOfflineApi;

    @GetMapping("shutdown")
    public void shutdown() throws NacosException {
        losslessOfflineApi.offlineService();
    }

    @GetMapping("fetchProviderServerInfo")
    public String fetchProviderServerInfo() {
        return feignProvider.fetchServerInfo();
    }
}
